<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>作业01</title>
	</head>
	<body>
		<script>
			function calculate(num1,num2,arithmetic){
				switch(arithmetic){
					case '+': return num1 + ' + '+num2 +' = '+(num1 + num2)
					case '-': return num1 + ' - '+num2 +' = '+(num1 - num2)
					case '*': return num1 + ' * '+num2 +' = '+(num1 * num2)
					case '/': 
						if(num2 == 0){
							alert('Division by zero is not allowed!')
						}
						return num1 + ' / '+num2 +' = '+(num1 / num2)
					default:
						alert('Invalid operator. Please use correct operator!')
				}
			}
			console.log(calculate(5,3,'+'))
		</script>
	</body>
</html>